using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Jfc007.WebLib
{
    public class DocumentInfo
    {

        #region Private Members

        private string m_emailId;

        public string EmailId
        {
            get { return m_emailId; }
            set { m_emailId = value; }
        }
        private int m_stars;
        public int Stars
        {
            get { return m_stars; }
            set { m_stars = value; }
        }

        private string _ShareCode;

        public string ShareCode
        {
            get { return _ShareCode; }
            set { _ShareCode = value; }
        }

        private string _Keywords;
        public string Keywords
        {
            get { return _Keywords; }
            set { _Keywords = value; }
        }
        private string _Extension;
        public string Extension
        {
            get { return _Extension; }
            set { _Extension = value; }
        }

        private Boolean _Share;

        public Boolean Share
        {
            get { return _Share; }
            set { _Share = value; }
        }

        private int _ModuleId;
        private Guid _FileId;
        private string _FileName;
        private int _UserId;
        private string _ContentType;
        private Byte[] _Content;
        private string _Category;
        private long _ByteSize;
        private string _FileDescription;
        private int _CreatedByUser;
        private DateTime _CreatedDate;
        #endregion

        #region Constructors

        // initialization
        public DocumentInfo()
        {
        }

        #endregion

        #region Public Properties

        static public string ByteSizeToString(long byteSize)
        {
            if (byteSize < 1024)
                return String.Format("{0:D} B", byteSize);
            else if (byteSize < (1024 * 1024))
                return String.Format("{0:D} KB", byteSize / 1024);
            else if (byteSize < (1024 * 1024 * 1024))
                return String.Format("{0:D} MB", byteSize / (1024 * 1024));
            else
                return String.Format("{0:D} GB", byteSize / (1024 * 1024 * 1024));
        }

        public int UserId
        {
            get { return _UserId; }
            set { _UserId = value; }
        }

        public string ContentType
        {
            get { return _ContentType; }
            set { _ContentType = value; }
        }

        public Guid FileGuid
        {
            get { return _FileId; }
            set { _FileId = value; }
        }


        public string Category
        {
            get { return _Category; }
            set { _Category = value; }
        }
        public string FileName
        {
            get { return _FileName; }
            set { _FileName = value; }
        }

        public long ByteSize
        {
            get { return _ByteSize; }
            set { _ByteSize = value; }
        }

        /// <summary>
        /// Returns a string that represents the file length (ByteSize) in
        /// Bytes (B), Kilo Bytes (KB) or Mega Bytes (MB)
        /// </summary>
        public string SizeLenText
        {
            get
            {
                return DocumentInfo.ByteSizeToString(ByteSize);
            }
        }

        public string FileDescription
        {
            get { return _FileDescription; }
            set { _FileDescription = value; }
        }

        /// <summary>
        /// Gets and sets the Module Id
        /// </summary>
        public int PortalId
        {
            get
            {
                return _ModuleId;
            }
            set
            {
                _ModuleId = value;
            }
        }


        /// <summary>
        /// gets and sets the content
        /// </summary>
        public byte[] Content
        {
            get
            {
                return _Content;
            }
            set
            {
                _Content = value;
            }
        }

        /// <summary>
        /// Gets and sets the User Id who Created/Updated the content
        /// </summary>
        public int CreatedByUser
        {
            get
            {
                return _CreatedByUser;
            }
            set
            {
                _CreatedByUser = value;
            }
        }

        /// <summary>
        /// Gets and sets the Date when Created/Updated
        /// </summary>
        public DateTime CreatedDate
        {
            get
            {
                return _CreatedDate;
            }
            set
            {
                _CreatedDate = value;
            }
        }



        #endregion

    }
}
